FLEX=flex
BISON=bison
COMPILER=g++
PROGRAM_NAME=jjsched_compilehelp
SRC_PATH=src/czestmyr/jjsched/
DOC_PATH=documentationtemplates/
CCFLAGS=-g

.PHONY: all
.PHONY: run
.PHONY: clean

all: program

run:
	./${PROGRAM_NAME} --class help.txt >../${SRC_PATH}Help.java
	./${PROGRAM_NAME} --html help.txt >../${DOC_PATH}commands.html

clean:
	rm -f src/*.o src/scanner.h src/scanner.c src/parser.h src/parser.c

program: src/main.o src/scanner.o
	${COMPILER} ${CCFLAGS} -o ${PROGRAM_NAME} src/main.o src/scanner.o

src/main.o: src/scanner.c src/parser.c src/main.cpp
	${COMPILER} ${CCFLAGS} -o src/main.o -c src/main.cpp

src/scanner.o: src/scanner.c
	${COMPILER} ${CCFLAGS} -o src/scanner.o -c src/scanner.c

src/scanner.c: src/scanner.l
	${FLEX} -osrc/scanner.c --header-file=src/scanner.h src/scanner.l

src/parser.c: src/parser.y
	${BISON} -d -o src/parser.c src/parser.y
	
